This document provides instructions for downloading and installing R and RStudio on a Windows machine. (Note: I do not personally own a Windows machine so some of these instructions might be outdated. If the installation instructions you face are different from what is outlined here, please let me know.)
Make sure that you have about 500 MB of free space on your machine. We will need this space to install both R and RStudio, and when the program installs the compressed files expand to take much more space.
Go to this website.
Click on the “Download R 3.5.1 for Windows” link at the top of the page. Your download should start.
R is now installed on your computer.
Note: This version of R should run with no problems on Windows XP and later.
The >
character is called the prompt and is the place where we enter commands for the program to interpret. For instance, if you type 25+26
followed by the return/enter key, you will see:
25+26
## [1] 51
q()
and htting the return key.q()
R will ask you if you want to save your work. Don’t save it. You have now left R.
We are not going to use R this way often, as we will use an integrated environment called RStudio.
Go to this website.
Click on the “RStudio 1.1.456 - Windows Vista/7/8/10” link. The file download will begin.
Once the file has been downloaded, click on it and walk through the installation process.
C:\Program Files\RStudio
.RStudio is now installed on your computer.
Note: For RStudio to work, R needs to be installed first.
Just as in R, the >
character in the Console window is where we enter commands for the program to interpret.
To exit RStudio, click on the red X at the top-right corner of the window. If prompted to save the workspace, do not save it.
In the Windows system, path names use backslashes, e.g. C:\Users\username\RWork\
. R, on the other hand, inherits its file and folder naming conventions from Unix which uses forward slashes instead: C:/Users/susan/RWork/
.
In Unix conventions, backslashes are actually used for a different purpose (to isolate special characters and stop them from being immediately interpreted).
As a rule, to avoid problems, we should avoid naming directories and files with spaces and special characters.
If you already have an important directory with a space in its name, know that when trying to reference that directory in R, you have to put a backslash in front of each space.
Note: (“C:\Path\To\A\File”) is the same as (“C:/Path/To/A/File”).